import { request } from '@/utils/request';


export function login(data?: Recordable) {
  return request({
    url: `/api/user/login`,
    method: 'post',
     data,
  });
}
export function register(data?: Recordable) {
  return request({
    url: `/api/user/register`,
    method: 'post',
     data,
  });
}
export function logout(data?: Recordable) {
  return request({
    url: `/api/user/logout`,
    method: 'post',
     data,
  });
}
export function profile(data?: Recordable) {
  return request({
    url: `/api/user/profile`,
    method: 'get',
     params:data,
  });
}
export function indexConfigLang(data?: Recordable) {
  return request({
    url: `/api/index/configLang`,
    method: 'get',
    params:data,
  });
}
export function indexChangeLang(data?: Recordable) {
  return request({
    url: `/api/index/changeLang`,
    method: 'get',
    params:data,
  });
}
export function indexGoodsList(data?: Recordable) {
  return request({
    url: `/api/index/goodsList`,
    method: 'get',
    params:data,
  });
}

export function goodsCategory(data?: Recordable) {
  return request({
    url: `/api/goods/category`,
    method: 'get',
    params:data,
  });
}
export function goodsList(data?: Recordable) {
  return request({
    url: `/api/goods/list`,
    method: 'get',
    params:data,
  });
}
export function goodsDetail(data?: Recordable) {
  return request({
    url: `/api/goods/detail`,
    method: 'get',
    params:data,
  });
}
export function goodsLike(data?: Recordable) {
  return request({
    url: `/api/goods/like`,
    method: 'get',
    params:data,
  });
}
// 获取评论
export function goodsComment(data?: Recordable) {
  return request({
    url: `/api/goods/comment`,
    method: 'get',
    params:data,
  });
}
// 更新购物车
export function cartUpdate(data?: Recordable) {
  return request({
    url: `/api/cart/update`,
    method: 'post',
    data,
  });
}
// 购物车列表
export function cartList(data?: Recordable) {
  return request({
    url: `/api/cart/list`,
    method: 'get',
    params:data,
  });
}
// 删除购物车
export function cartDelete(data?: Recordable) {
  return request({
    url: `/api/cart/delete`,
    method: 'post',
    data,
  });
}
// 国家地址
export function addressCountry(data?: Recordable) {
  return request({
    url: `/api/address/country`,
    method: 'get',
   params: data,
  });
}
// 添加地址
export function addressAdd(data?: Recordable) {
  return request({
    url: `/api/address/add`,
    method: 'post',
    data,
  });
}
// 编辑地址
export function addressEdit(data?: Recordable) {
  return request({
    url: `/api/address/edit`,
    method: 'post',
    data,
  });
}
// 删除地址
export function addressDelete(data?: Recordable) {
  return request({
    url: `/api/address/delete`,
    method: 'post',
    data,
  });
}
// 地址列表
export function addressList(data?: Recordable) {
  return request({
    url: `/api/address/list`,
    method: 'get',
    params:data,
  });
}
// 默认地址
export function addressDfault(data?: Recordable) {
  return request({
    url: `/api/address/default`,
    method: 'get',
    params:data,
  });
}

// 获取结算页信息
export function orderCalc(data?: Recordable) {
  return request({
    url: `/api/order/calc`,
    method: 'post',
    data,
  });
}
// 优惠券获取
export function orderCoupons(data?: Recordable) {
  return request({
    url: `/api/order/coupons`,
    method: 'post',
    data,
  });
}
// 创建订单
export function orderCreate(data?: Recordable) {
  return request({
    url: `/api/order/create`,
    method: 'post',
    data,
  });
}
// 配置接口
export function indexConfigValue(data?: Recordable) {
  return request({
    url: `/api/index/configValue`,
    method: 'get',
   params:data,
  });
}
export function indexCarousel(data?: Recordable) {
  return request({
    url: `/api/index/carousel`,
    method: 'get',
   params:data,
  });
}
export default {
  login,
 register,
 profile,
 logout,
 indexConfigLang,
 indexChangeLang,
 indexGoodsList,
 goodsCategory,
 goodsList,
 goodsDetail,
 goodsLike,
 goodsComment,
 cartUpdate,
 cartList,
 cartDelete,
 addressCountry,
 addressAdd,
 addressEdit,addressDelete,addressList,orderCalc,orderCoupons,addressDfault,orderCreate,
 indexConfigValue,indexCarousel
};
